<!-- 轮播图组件 -->
<template>
    <div class="block">
        <el-carousel :interval="3000" height="200px">
            <el-carousel-item v-for="(item, index) in bannerData" :key="index">
                <div class="carousel-image-container">
                    <img :src="item.imageUrl" class="carousel-image">
                </div>
            </el-carousel-item>
        </el-carousel>
    </div>
</template>

<script setup>
import { defineProps } from 'vue';
defineProps(['bannerData']);
</script>

<style scoped>
.block {
    width: 100%;
    height: 100%;
}

.carousel-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-color: #f5f5f5; /* 留白区域的背景色 */
}

.carousel-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Element UI 默认样式保留 */
.el-carousel__item h3 {
    color: #475669;
    font-size: 14px;
    opacity: 0.75;
    line-height: 200px;
    margin: 0;
}

.el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
}
</style>